package com.dgut.dao;

import com.dgut.domain.Account;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface AccountDao {

    /**
     * 根据id查找用户
     * @param id
     * @return
     */
    @Select("select * from account where id = #{id}")
    public Account findById(Integer id);


    /**
     * 根据姓名查找用户
     * @param name
     * @return
     */
    @Select("select * from account where name = #{name}")
    public Account findByName(String name);


    /**
     * 更新账户信息
     * @param account
     * @return
     */
    @Update("update account set money=#{money} where name=#{name}")
    public int updateAccount(Account account);


}
